package com.hzdl.controller;

import com.hzdl.dao.impl.AccountDaoImpl1;
import com.hzdl.service.impl.AccountServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AccountController {

//    AccountService accountService = new AccountServiceImpl();

    @Test
    public void call() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("tt.xml");
//        AccountService accountService = (AccountService) applicationContext.getBean("accountServiceImpl");
        AccountServiceImpl accountServiceImpl = applicationContext.getBean("accountServiceImpl", AccountServiceImpl.class);
        System.out.println(accountServiceImpl);


//        accountService.save();
    }


    @Test
    public void call2(){
        /*用依赖注入生成javaBean对象*/
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
//        AccountDaoImpl1 accountDaoImpl1 = applicationContext.getBean("accountDaoImpl1", AccountDaoImpl1.class);
        AccountDaoImpl1 accountDaoImpl2 = applicationContext.getBean("accountDaoImpl1", AccountDaoImpl1.class);
//        System.out.println(accountDaoImpl1);




    }





}
